<template>
    <div class='printSelect'>
        <div class='items' v-for="(item,index) in printName" :key="index" @click="print(item)">{{item}}</div>
        
        <common-print :printDatas="printData" style='height:1px;position:absolute;bottom:0px;overflow:hidden'  v-if="isPrint=='Y'"></common-print>
    </div>
</template>
<script>
import CommonPrint  from './CommonPrint.vue'
export default {
    props:["commonData"],
    name:"printSelect",
    components:{
        CommonPrint
    },
    data(){
        return{
           printName:[],
           printData:{},
           isPrint:"N",
           ids:""
        }
    },
    created(){
        this.printName=this.commonData.printName.split(",");
    },
    methods:{
        print(item){
            
            let printData_={};
            printData_.printName=item;
            printData_.sCurItem=this.commonData.sId;
            printData_.sCurItems=this.commonData.ids;
            printData_.appid=this.commonData.appid;
            printData_.token=sessionStorage.getItem("token");
            printData_.isPrint="Y";
            this.isPrint="Y"
            this.printData=printData_;
           
        }
    }
}
</script>
<style scoped>
.printSlect{
    display:flex;
    flex-direction: row;
    flex-wrap: wrap;
}
.items{
    padding:10px;
    display:inline-block;
    height:50px;
    line-height: 50px;
    border:1px solid #ddd;
    margin:10px;
    cursor: pointer;
}
</style>